﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace WindStyle.SPEntity.Attributes
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class UrlFieldAttribute : FieldAttribute
    {
        public string UrlProperty { get; private set; }
        public string DescriptionProperty { get; private set; }
        public UrlValue ValuePart { get; private set; }

        public UrlFieldAttribute(string fieldName, string urlProperty, string descriptionProperty)
            :base(fieldName)
        {
            this.Mode = MappingMode.ReadWrite;
            this.UrlProperty = urlProperty;
            this.DescriptionProperty = descriptionProperty;
            this.ValuePart = UrlValue.Url|UrlValue.Description;
        }


        public UrlFieldAttribute(string fieldName, UrlValue valuePart)
            : base(fieldName)
        {
            this.Mode = MappingMode.ReadOnly;
            this.ValuePart = valuePart;
        }
    }

    [Flags]
    public enum UrlValue
    {
        Url = 1,
        Description = 2
    }
}
